import { OnDestroy ,Directive, ElementRef, Input, Renderer } from '@angular/core';


@Directive({
     selector: '[myValidatorForm]' 
    })
export class ValidateDirective implements OnDestroy  {
    private myvalidator : kendo.ui.Validator;
    constructor(el: ElementRef, renderer: Renderer) {
        this.myvalidator = new kendo.ui.Validator(<Element>el.nativeElement); 
    }

    public validate():boolean {
        return this.myvalidator.validate();
    }
    
    ngOnDestroy(){
        this.myvalidator.destroy();
    } 
}